package com.client;

import com.entity.*;
import java.util.ArrayList;
import java.lang.Math;


public class Simulator {

    private ArrayList<Commodity> productTable=new ArrayList<>();
    private Order order;
    private ArrayList<WareHouse> WareHouses=new ArrayList<>();

    public void generateProductTable(){
        for(int i=1;i<=10;i++){
            int wareHouseId = 1+(int)Math.random()*5;
            Size size=new Size((float)Math.random()*2, (float)Math.random()*2, (float)Math.random()*2);
            Commodity commodity=new Commodity(i,wareHouseId,(float)Math.random()*5,size,(float)Math.random()*10);
            productTable.add(commodity);
        }
    }

    public void generateOrder(){
        order.setOrderId("1");
        Address address=new Address((float)Math.random()*10,(float)Math.random()*10);
        order.setAddress(address);
        ArrayList<Commodity> commodities=new ArrayList<>();
        int amount=1+(int)Math.random()*10;
        for(int i=0;i<amount;i++){
            int index=1+(int)Math.random()*10;
            commodities.add(productTable.get(index));
        }
    }

    public void generateWareHouseTable(){
        for(int i=1;i<=5;i++){
            Address address=new Address((float)Math.random()*10,(float)Math.random()*10);
            WareHouse wareHouse=new WareHouse(i,address);
            WareHouses.add(wareHouse);
        }
    }

    public ArrayList<Commodity> getProductTable() {
        return productTable;
    }

    public Order getOrder() {
        return order;
    }

    public ArrayList<WareHouse> getWareHouses() {
        return WareHouses;
    }
}
